tempprobe 2.2.0
Loading...
Searching...
No Matches
tempprobe


Temp Probe Click

Temp Probe Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Stefan Ilic
  • Date : Aug 2021.
  • Type : SPI type

Software Support

Example Description

This is an example that demonstrates the use of the Temp Probe Click board.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.TempProbe

Example Key Functions

  • tempprobe_cfg_setup Config Object Initialization function.
    void tempprobe_cfg_setup(tempprobe_cfg_t *cfg)
    Temp Probe configuration object setup function.
    Temp Probe Click configuration object.
    Definition tempprobe.h:347
  • tempprobe_init Initialization function.
    err_t tempprobe_init(tempprobe_t *ctx, tempprobe_cfg_t *cfg)
    Temp Probe initialization function.
    Temp Probe Click context object.
    Definition tempprobe.h:327
  • tempprobe_default_cfg Click Default Configuration function.
    err_t tempprobe_default_cfg(tempprobe_t *ctx)
    Temp Probe default configuration function.
  • tempprobe_write_word Word Write function.
    err_t tempprobe_write_word ( tempprobe_t *ctx, uint16_t reg_addr, uint32_t data_in );
  • tempprobe_read_bytes Byte Read function.
    err_t tempprobe_read_bytes( tempprobe_t *ctx, uint16_t reg_addr, uint8_t *data_out, uint8_t n_bytes );
    err_t tempprobe_read_bytes(tempprobe_t *ctx, uint16_t reg_addr, uint8_t *data_out, uint8_t n_bytes)
    Byte Read function.
  • tempprobe_read_temp Temperature Read function.
    uint8_t tempprobe_read_temp ( tempprobe_t *ctx, uint16_t sel_channel, float *data_out );
    uint8_t tempprobe_read_temp(tempprobe_t *ctx, uint16_t sel_channel, float *data_out)
    Temperature Read function.

Application Init

Initializes SPI interface and performs a device configuration for properly working and configures the desired channels.

void application_init ( void )
{
log_cfg_t log_cfg;
tempprobe_cfg_t tempprobe_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
tempprobe_cfg_setup( &tempprobe_cfg );
TEMPPROBE_MAP_MIKROBUS( tempprobe_cfg, MIKROBUS_1 );
if ( SPI_MASTER_ERROR == tempprobe_init( &tempprobe, &tempprobe_cfg ) )
{
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
tempprobe_reset( &tempprobe );
Delay_ms ( 300 );
if ( TEMPPROBE_ERROR == tempprobe_default_cfg( &tempprobe ) )
{
log_error( &logger, " Config Error " );
for ( ; ; );
}
Delay_ms ( 300 );
log_info( &logger, " Application Task " );
}
#define TEMPPROBE_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition tempprobe.h:311
void tempprobe_reset(tempprobe_t *ctx)
Reset function.
void application_init(void)
Definition main.c:28
@ TEMPPROBE_ERROR
Definition tempprobe.h:372

Application Task

Measure temperatures from all sensors and display the measurements on the serial port.

void application_task ( void )
{
float temperature_k = 0;
float temperature_pn = 0;
while ( TEMPPROBE_NO_BUSY_STATE != tempprobe_check_busy( &tempprobe ) );
log_printf( &logger, " PN-Junction: %.2f C\r\n", temperature_pn );
tempprobe_read_temp( &tempprobe, TEMPPROBE_REG_THERMO_K_CONV_RES, &temperature_k );
log_printf( &logger, " Thermo K: %.2f C\r\n", temperature_k );
log_printf( &logger, "------------------------\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 500 );
}
#define TEMPPROBE_REG_PN_JUNCTION_CONV_RES
Definition tempprobe.h:76
#define TEMPPROBE_REG_COMM_STATUS
Temp Probe description register.
Definition tempprobe.h:74
#define TEMPPROBE_REG_THERMO_K_CONV_RES
Definition tempprobe.h:75
#define TEMPPROBE_NO_BUSY_STATE
Definition tempprobe.h:275
#define TEMPPROBE_START_CONV
Temp Probe EEPROM setting.
Definition tempprobe.h:223
err_t tempprobe_write_byte(tempprobe_t *ctx, uint16_t reg_addr, uint8_t data_in)
Byte Write function.
uint8_t tempprobe_check_busy(tempprobe_t *ctx)
Busy Check function.
void application_task(void)
Definition main.c:67

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.